# 1. 用类封装一个MyMath类, 改写为静态方法
class MyMath:

    @staticmethod
    def add(x, y):
        return x + y
    # 1、加法

    @staticmethod
    def suy(x, y):
        return x - y
    # 2、减法

    @staticmethod
    def mul(x, y):
        return x * y
    # 3、乘法

    @staticmethod
    def divide(x, y):
        return x / y
    # 4、除法

    @staticmethod
    def douyle_div(x, y):
        return x // y
    # 5、整除

    @staticmethod
    def surplus(x, y):
        return x ** y
    # 6、幂

    @staticmethod
    def sqrt(x):
        return x ** (1 / 2)
    # 7、开方

print("1：加法")
print("2：减法")
print("3：乘法")
print("4：除法")
print("5：整除")
print("6：幂")
print("7：开方")

A = input("请输入数字,选择你想进行的运算: ")

if A == '7':
    x = int(input("请输入数字进行开方:"))
else:
    x = int(input("请输入第 1 个数字:"))
    y = int(input("请输入第 2 个数字:"))

if A == '1':
    print(x, "+",y ,"=" , MyMath.add(x, y))
elif A == "2":
    print(x, "-", y,"=", MyMath.suy(x,y))
elif A == "3":
    print(x, "*", y,"=", MyMath.mul(x,y))
elif A == "4":
    print(x, "/", y,"=", MyMath.devide(x,y))
elif A == "5":
    print(x, "//", y,"=", MyMath.douyle_div(x,y))
elif A == "6":
    print(x, "**", y,"=", MyMath.surplus(x,y))
elif A == "7":
    print(x, "开方的结果为:","=", MyMath.sqrt(x))
else:
    print("请在指定范围内进行选择！")

# 2 为上节课自定义类添加如下功能:
class Cars:
    a = "丰田" #添加类属性
    __e = "长安" #类的私有属性

    def __init__(self, a1, b1):
        self.a = a1 #实例属性
        self.__b = b1 #私有实例属性

    def __str__(self):
        return f'今年一定要买一辆: {self.a}'

    def BuyCar(self):
        return f"今年一定要买一辆: %s" % (self.a)# 自定义输出格式

    @classmethod
    def get_e(cls):
        return cls.__e

d = Cars("宝马","奔驰")
print(d)
print("------分隔符------")

print(Cars._Cars__e) #访问类的私有属性
print("------分隔符------")

class Mycar(Cars):
    print("我的车是:",Cars.a)#访问类属性